package com.example.config.demo;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;


/**
 * @author yuisama
 * @date 2023/02/01 16:38
 **/
//使用Component注册到SpringZhong
@Component
@ConfigurationProperties(prefix = "xiaojing")
public class XiaojingConfig {
    private String name;

    private String age;

    //必须要写的方法setter,否则不会生效,使用public修饰
    public void setAge(String age) {
        this.age = age;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getName() {
        return name;}

    public String getAge() {
        return age;
    }
}

